package com.yw.controller;

import com.yw.result.R;
import com.yw.service.ColumnService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Tag(name = "栏目管理",description = "栏目管理")
@RequestMapping("/column")
public class ColumnController {

    @Resource
    private ColumnService columnService;

    @Operation(summary = "查询所有栏目",description = "查询所有栏目")
    @PostMapping("/getAllColumn")
    public R getAllColumn(){
        return R.OK(columnService.list());
    }

    @Operation(summary = "查询所有该目录下的栏目",description = "查询所有栏目")
    @PostMapping("/getAllColumnByContentsId")
    public R getAllColumnByContentsId(Integer id){
        return R.OK(columnService.getAllColumnByContentsId(id));
    }
}
